package lq20263;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		for (int i = 1; i < 2026; i++) {
			if (i % 3 == 0 || i % 8 == 0 || i % 38 == 0) {
				count++;
			}
		}
		System.out.println(count);

	}

}
